package Eve.EveB;

class PriorList implements Comparable {
	public WordLink data;
	public PriorList prev;
	public PriorList next;

	public PriorList(WordLink data, PriorList prev, PriorList next)
	{
		this.data = data;
		this.prev = prev;
		this.next = next;
	}

    public String allList()
	{
		PriorList tmp=this;
        String ans="";
		while (tmp!= null)
		{
			ans+= tmp.data.toString()+" ";
            tmp=tmp.next;
		}
		return ans;
	}

    public String toString(){
        return data.toString();
    }

    public int compareTo(Object o){
		if(o!=null && o instanceof PriorList){
			PriorList ll = ((PriorList)o);
			return (this.data).compareTo(ll.data);
		}
		return 1;
	}

	public boolean equals(Object o){
        return o != null && o instanceof PriorList && compareTo(o) == 0;
    }

    public String getWord(){
        if(data!=null)
            return data.word;
        return null;
    }
}